<!DOCTYPE HTML>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">

    

    <title>十七条成功定律 | 程序员Sherwin</title>
    <meta name="author" content="Sherwin Wei">
    
    <meta name="description" content="十七条成功定律——最有价值、带有规律性的定律
1. 积极的心态（PMA黄金定律）积极的心态包括诚恳、忠诚、正直、乐观、勇敢、奋发、创造、机智、亲切、友善、积极、向善、向上、进取、努力、愉快、自信、自勉和有安全感等。
2. 明确的目标你过去和现在的情况并不重要，你将来想获得什么成就才是最重要的。有目标">
    

   
   <meta name="keywords" content="魏远标,Sherwin,java程序员,程序员Sherwin,程序员魏远标">
   
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">

    <meta property="og:title" content="十七条成功定律"/>
    <meta property="og:site_name" content="程序员Sherwin"/>

    
    <meta property="og:image" content=""/>
    

    <link rel="icon" type="image/png" href="/favicon.png">
    <link rel="alternate" href="/atom.xml" title="程序员Sherwin" type="application/atom+xml">
    <link rel="stylesheet" href="/css/lib/materialize.min.css">
    <link rel="stylesheet" href="/css/lib/font-awesome.min.css">
    <link rel="stylesheet" href="/css/style.css" media="screen" type="text/css">

    
        <link rel="stylesheet" href="/css/lib/prettify-tomorrow-night-eighties.css" type="text/css">
    
    <!--[if lt IE 9]><script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script><![endif]-->
</head>


<body>
    <img src="/weixin_favicon.png" style="position: absolute; left: -9999px; opacity: 0; filter: alpha(opacity=0);">

    <nav class="indigo">
    <div class="nav-wrapper">
        <a href="#" data-activates="main-menu" class="button-collapse">
            <i class="fa fa-navicon"></i>
        </a>
        <div class="">
            <a href="/" class="brand-logo hide-on-med-and-down">程序员Sherwin</a>
            <ul class="right hide-on-med-and-down">
                
                    <li>
                        <a class="menu-home " href="/" >
                            <i class="fa fa-home "></i>
                            
                            首页
                        </a>
                    </li>
                
                    <li>
                        <a class="menu-archive " href="/archives" >
                            <i class="fa fa-archive "></i>
                            
                            归档
                        </a>
                    </li>
                
                    <li>
                        <a class="menu-category category-menu" href="javascript:;" data-activates="category-menu" >
                            <i class="fa fa-bookmark "></i>
                            
                            分类
                        </a>
                    </li>
                
                    <li>
                        <a class="menu-reading " href="/reading" >
                            <i class="fa fa-book "></i>
                            
                            读书
                        </a>
                    </li>
                
                    <li>
                        <a class="menu-about " href="/about" >
                            <i class="fa fa-user "></i>
                            
                            关于
                        </a>
                    </li>
                
                    <li>
                        <a class="menu-search modal-trigger " href="#search" >
                            <i class="fa fa-search "></i>
                            
                            搜索
                        </a>
                    </li>
                
            </ul>
            <div>
    <ul class="side-nav indigo darken-1" id="main-menu">
        
        <li class="side-user">
            <div class="row">
                <div class="col s4 no-padding">
                    <img class="avatar-image circle responsive-img" src="http://p5zbw6dku.bkt.clouddn.com/18-3-27/79800938.jpg" alt="User Avatar">
                </div>
                <div class="info col s8 valign-wrapper no-padding">
                    <div class="valign">
                        <p class="name">魏远标</p>
                        <p class="desc">Java后端/全栈</p>
                    </div>
                </div>
            </div>
        </li>
        

        
            <li class="no-padding">
                <a class="waves-effect menu-home " href="/" >
                    <i class="fa fa-home "></i>
                    
                    首页
                </a>
            </li>
        
            <li class="no-padding">
                <a class="waves-effect menu-archive " href="/archives" >
                    <i class="fa fa-archive "></i>
                    
                    归档
                </a>
            </li>
        
            <li class="no-padding">
                <a class="waves-effect menu-category category-menu" href="javascript:;" data-activates="category-menu" >
                    <i class="fa fa-bookmark "></i>
                    
                    分类
                </a>
            </li>
        
            <li class="no-padding">
                <a class="waves-effect menu-reading " href="/reading" >
                    <i class="fa fa-book "></i>
                    
                    读书
                </a>
            </li>
        
            <li class="no-padding">
                <a class="waves-effect menu-about " href="/about" >
                    <i class="fa fa-user "></i>
                    
                    关于
                </a>
            </li>
        
            <li class="no-padding">
                <a class="waves-effect menu-search modal-trigger " href="#search" >
                    <i class="fa fa-search "></i>
                    
                    搜索
                </a>
            </li>
        
    </ul>

    <ul class="side-nav indigo darken-1" id="category-menu">
    

            

            <li class="collapse-level-0" collapse-level="0">
                <a class="no-padding" href="/categories/java/">
                    java <span class="right">12 篇</span></a>
                </a>
            </li>

        

            <li class="collapse-level-0" collapse-level="0">
                <a class="no-padding" href="/categories/linux/">
                    linux <span class="right">2 篇</span></a>
                </a>
            </li>

        

            <li class="collapse-level-0" collapse-level="0">
                <a class="no-padding" href="/categories/web前端/">
                    web前端 <span class="right">1 篇</span></a>
                </a>
            </li>

        

            <li class="collapse-level-0" collapse-level="0">
                <a class="no-padding" href="/categories/生活/">
                    生活 <span class="right">7 篇</span></a>
                </a>
            </li>

        

            <li class="collapse-level-0" collapse-level="0">
                <a class="no-padding" href="/categories/网络/">
                    网络 <span class="right">1 篇</span></a>
                </a>
            </li>

        

            <li class="collapse-level-0" collapse-level="0">
                <a class="no-padding" href="/categories/java面试/">
                    java面试 <span class="right">3 篇</span></a>
                </a>
            </li>

        

            <li class="collapse-level-0" collapse-level="0">
                <a class="no-padding" href="/categories/juc/">
                    juc <span class="right">1 篇</span></a>
                </a>
            </li>

        

            <li class="collapse-level-0" collapse-level="0">
                <a class="no-padding" href="/categories/jvm/">
                    jvm <span class="right">2 篇</span></a>
                </a>
            </li>

        

            <li class="collapse-level-0" collapse-level="0">
                <a class="no-padding" href="/categories/mybatis/">
                    mybatis <span class="right">1 篇</span></a>
                </a>
            </li>

        

            <li class="collapse-level-0" collapse-level="0">
                <a class="no-padding" href="/categories/spring/">
                    spring <span class="right">1 篇</span></a>
                </a>
            </li>

        

    </ul>
</div>

        </div>
    </div>
</nav>

<div id="search" class="modal search-modal">
    <div class="row">
        <div class="input-field col s12">
              <input id="search-input" type="text">
              <label for="search-input">搜索</label>
        </div>

    </div>
    <div id="search-result" class="search-result col s12">

    </div>
</div>


    <main>
        <div class="container main-container">
    <nav class="page-nav hide-on-small-only">
    <div class="nav-wrapper indigo">
        <span class="breadcrumb">当前位置（分类目录）</span>
        
            
    
    
    <a class="breadcrumb" href="/categories/生活/">生活</a>


        

        
    </div>
</nav>

<article>
    <div class="card">
        <div class="card-content">
            

            <div class="article-title">
                
    
        <h1>十七条成功定律</h1>
    


            </div>
            <time class="pink-link-context" datetime="2016-04-11T09:40:20.000Z"><a href="/生活/十七条成功定律/">2016-04-11</a></time>

            <span id="busuanzi_container_page_pv" class="read-times-container">
    <i class="fa fa-eye"></i>
    <span id="busuanzi_value_page_pv"></span>
</span>

            
    <div class="tags-row">
        
            <a href="/tags/生活-成功/" class="chip pink lighten-1">生活,成功</a>
        
    </div>


            <div class="toc pink-link-context hide-on-med-and-down">
    <ol class="section table-of-contents"><li class="section table-of-contents-item section table-of-contents-level-1"><a class="section table-of-contents-link" href="#十七条成功定律"><span class="section table-of-contents-text">十七条成功定律</span></a><ol class="section table-of-contents-child"><li class="section table-of-contents-item section table-of-contents-level-3"><a class="section table-of-contents-link" href="#1-积极的心态（PMA黄金定律）"><span class="section table-of-contents-text">1. 积极的心态（PMA黄金定律）</span></a></li><li class="section table-of-contents-item section table-of-contents-level-3"><a class="section table-of-contents-link" href="#2-明确的目标"><span class="section table-of-contents-text">2. 明确的目标</span></a></li><li class="section table-of-contents-item section table-of-contents-level-3"><a class="section table-of-contents-link" href="#3-多走些路"><span class="section table-of-contents-text">3. 多走些路</span></a></li><li class="section table-of-contents-item section table-of-contents-level-3"><a class="section table-of-contents-link" href="#4-正确的思考方法"><span class="section table-of-contents-text">4. 正确的思考方法</span></a></li><li class="section table-of-contents-item section table-of-contents-level-3"><a class="section table-of-contents-link" href="#5-高度的自制力"><span class="section table-of-contents-text">5. 高度的自制力</span></a></li><li class="section table-of-contents-item section table-of-contents-level-3"><a class="section table-of-contents-link" href="#6-培养领导才能"><span class="section table-of-contents-text">6. 培养领导才能</span></a></li><li class="section table-of-contents-item section table-of-contents-level-3"><a class="section table-of-contents-link" href="#7-建立自信心"><span class="section table-of-contents-text">7. 建立自信心</span></a></li><li class="section table-of-contents-item section table-of-contents-level-3"><a class="section table-of-contents-link" href="#8-迷人的个性"><span class="section table-of-contents-text">8.迷人的个性</span></a></li><li class="section table-of-contents-item section table-of-contents-level-3"><a class="section table-of-contents-link" href="#9-创新致胜"><span class="section table-of-contents-text">9. 创新致胜</span></a></li><li class="section table-of-contents-item section table-of-contents-level-3"><a class="section table-of-contents-link" href="#10-充满热诚"><span class="section table-of-contents-text">10. 充满热诚</span></a></li><li class="section table-of-contents-item section table-of-contents-level-3"><a class="section table-of-contents-link" href="#11-专心致志"><span class="section table-of-contents-text">11. 专心致志</span></a></li><li class="section table-of-contents-item section table-of-contents-level-3"><a class="section table-of-contents-link" href="#12-富有合作精神"><span class="section table-of-contents-text">12. 富有合作精神</span></a></li><li class="section table-of-contents-item section table-of-contents-level-3"><a class="section table-of-contents-link" href="#13-正确看待失败"><span class="section table-of-contents-text">13. 正确看待失败</span></a></li><li class="section table-of-contents-item section table-of-contents-level-3"><a class="section table-of-contents-link" href="#14-永葆进取心"><span class="section table-of-contents-text">14. 永葆进取心</span></a></li><li class="section table-of-contents-item section table-of-contents-level-3"><a class="section table-of-contents-link" href="#15-合理安排时间和金钱"><span class="section table-of-contents-text">15. 合理安排时间和金钱</span></a></li><li class="section table-of-contents-item section table-of-contents-level-3"><a class="section table-of-contents-link" href="#16-保持身心健康"><span class="section table-of-contents-text">16. 保持身心健康</span></a></li><li class="section table-of-contents-item section table-of-contents-level-3"><a class="section table-of-contents-link" href="#17-养成良好的习惯"><span class="section table-of-contents-text">17. 养成良好的习惯</span></a></li></ol></li></ol></li></ol>
</div>


            <div class="entry pink-link-context">
                <h1 id="十七条成功定律"><a href="#十七条成功定律" class="headerlink" title="十七条成功定律"></a>十七条成功定律</h1><pre><code>——最有价值、带有规律性的定律
</code></pre><h3 id="1-积极的心态（PMA黄金定律）"><a href="#1-积极的心态（PMA黄金定律）" class="headerlink" title="1. 积极的心态（PMA黄金定律）"></a>1. 积极的心态（PMA黄金定律）</h3><p>积极的心态包括诚恳、忠诚、正直、乐观、勇敢、奋发、创造、机智、亲切、友善、积极、向善、向上、进取、努力、愉快、自信、自勉和有安全感等。</p>
<h3 id="2-明确的目标"><a href="#2-明确的目标" class="headerlink" title="2. 明确的目标"></a>2. 明确的目标</h3><p>你过去和现在的情况并不重要，你将来想获得什么成就才是最重要的。有目标才会成功，如果你对未来没有理想，就做不出什么大事来。</p>
<h3 id="3-多走些路"><a href="#3-多走些路" class="headerlink" title="3. 多走些路"></a>3. 多走些路</h3><p>做个主动的人。要勇于实践，你的成功也就是因为多走了些路，找到了别人未找到的另外一点东西。抓住机会，掌握机会，做个积极主动的人，并养成及时行动的好习惯。</p>
<h3 id="4-正确的思考方法"><a href="#4-正确的思考方法" class="headerlink" title="4. 正确的思考方法"></a>4. 正确的思考方法</h3><p>成功等于正确的思想方法加信念加行动。要想成为思想方法正确的人，必须具备顽强坚定的性格，挖掘潜力，进行“我行”、“我是优秀的”、“还须再改进”的心理暗示。</p>
<h3 id="5-高度的自制力"><a href="#5-高度的自制力" class="headerlink" title="5. 高度的自制力"></a>5. 高度的自制力</h3><p>自制是一种最艰难的美德，有自制力才能抓住成功的机会。成功的最大敌人是自己，缺乏对自己情绪的控制，会把许多稍纵即逝的机会白白浪费掉。</p>
<h3 id="6-培养领导才能"><a href="#6-培养领导才能" class="headerlink" title="6. 培养领导才能"></a>6. 培养领导才能</h3><p>衡量一个领导人物成就的大小，要看他信念的深度、雄心的高度、理想的广度和他对下属关爱的程度。领导要练习赞美的艺术，对人要公正，管理要合乎人性。每一件事情都要精益求精，每一件事都要研究如何改善，每一件事都要订出更高的标准。</p>
<h3 id="7-建立自信心"><a href="#7-建立自信心" class="headerlink" title="7. 建立自信心"></a>7. 建立自信心</h3><p>一个人能否做成、做好一件事，首先看他是否有一个好的心态，以及是否能认真、持续地坚持下去。信心大、心态好，办法才多。</p>
<h3 id="8-迷人的个性"><a href="#8-迷人的个性" class="headerlink" title="8.迷人的个性"></a>8.迷人的个性</h3><p>对他人的生活、工作表示深切的关心；与人交往中求同存异，避免冲突；学会倾听别人的观点；学会夸奖别人；有微笑的魅力；别吝啬自己的同情；要学会认错，学会宽容大度。</p>
<h3 id="9-创新致胜"><a href="#9-创新致胜" class="headerlink" title="9. 创新致胜"></a>9. 创新致胜</h3><p>创造力是最珍贵的财富。如果你有这种能力，就能把握事业成功的最佳时机，从而创造伟大的奇迹。</p>
<h3 id="10-充满热诚"><a href="#10-充满热诚" class="headerlink" title="10. 充满热诚"></a>10. 充满热诚</h3><p>唯有热忱的态度，才是成功推销自己的重要因素。热忱的心态，是做任何事情都必需的条件。热忱是一种积极意识和状态，能够鼓励和激励他人采取行动，而且还具有感染和鼓舞他人的力量。</p>
<h3 id="11-专心致志"><a href="#11-专心致志" class="headerlink" title="11. 专心致志"></a>11. 专心致志</h3><p>没有专注，就不能应付生活的挑战。干什么都要求专注，专注就是用心，凡事用心终会成功。</p>
<h3 id="12-富有合作精神"><a href="#12-富有合作精神" class="headerlink" title="12. 富有合作精神"></a>12. 富有合作精神</h3><p>合作就有力量，合作是领导才能的基础，合作加速成功。</p>
<h3 id="13-正确看待失败"><a href="#13-正确看待失败" class="headerlink" title="13. 正确看待失败"></a>13. 正确看待失败</h3><p>失败是正常的，颓废是可耻的。要敢于屡败屡战，要摒弃消极思想，全力以赴，不消极等待，在吸取教训中改善求进，“成功是经过多次错误甚至大错之后才得到的”，用毅力克服阻碍，做自己的对手，战胜自己。</p>
<h3 id="14-永葆进取心"><a href="#14-永葆进取心" class="headerlink" title="14. 永葆进取心"></a>14. 永葆进取心</h3><p>进取心是成功的要素，应学会不为报酬而工作的精神，要有任劳任怨的敬业精神，勤学好问，不耻下问是放之四海而皆准的行为准则。 </p>
<h3 id="15-合理安排时间和金钱"><a href="#15-合理安排时间和金钱" class="headerlink" title="15. 合理安排时间和金钱"></a>15. 合理安排时间和金钱</h3><p>记住，浪费时间，就是浪费机会。效率就是生命，要把精力集中在那些回报率大的事情上。每天都有一个处理事情的先后顺序及进度，并身体力行，定期检查，杜绝懒惰和拖拖拉拉。金钱不是万恶之源，贪财才是万恶之源。金钱可以使你自信和充分地表现自我，养成储蓄的习惯，经济独立才有真自由。在金钱交往中，无论是公共关系，还是私人关系，应遵守互惠互利的原则，才能健康的长久发展。成功者要有赚钱的素质。</p>
<h3 id="16-保持身心健康"><a href="#16-保持身心健康" class="headerlink" title="16. 保持身心健康"></a>16. 保持身心健康</h3><p>要有健康的身体，因为健全的心灵和健康的身体，是成功的基本保证。要坚持锻炼身体，要经常地给自己充电，积极的心态要求有良好的能量水平。要能够使你自己健康长寿，成功地运用积极心态，你的身体就会越来越健康。</p>
<h3 id="17-养成良好的习惯"><a href="#17-养成良好的习惯" class="headerlink" title="17. 养成良好的习惯"></a>17. 养成良好的习惯</h3><p>好的习惯可以造就人才，坏的习惯可以毁灭人才。习惯，对人的成功与否都有巨大的影响力。好习惯的报酬是成功，好习惯是开启成功大门的钥匙，要有胸襟开阔的心理习惯、勇于纠正自己缺点的习惯、从容不迫的习惯、喜欢运动的习惯等。</p>
<ul>
<li>这十七条定律涵盖了人类取得成功的所有主观因素，主要与心态、思维方式和行为习惯有关。按十七条成功定律去做，你定能成为一名成功人士。坚持不懈，直到成功！                                      </li>
</ul>

                
<p class="pink-link-context">
    <a href="/java/旧博客转移/编译器自动优化导致代码可以先后写的问题/" rel="next" title="编译器自动优化导致代码可以先后写的问题">
    上一篇：编译器自动优化导致代码可以先后写的问题
  </a>
</p>



<p class="pink-link-context">
    <a href="/生活/编程的八大奥秘/" rel="next" title="成为编程高手的八大奥秘">
    下一篇：成为编程高手的八大奥秘
  </a>
</p>


            </div>
			
        </div>
    </div>
</article>




    <section id="comments">
        <!--高速版，加载速度快，使用前需测试页面的兼容性-->
        <div id="SOHUCS" sid="十七条成功定律"></div>
        <script>
          (function(){
            var appid = 'cytwu2Jh8',
            conf = 'prod_f36aa8fb3548cb02167fd6c482acf807';
            var doc = document,
            s = doc.createElement('script'),
            h = doc.getElementsByTagName('head')[0] || doc.head || doc.documentElement;
            s.type = 'text/javascript';
            s.charset = 'utf-8';
            s.src =  'http://assets.changyan.sohu.com/upload/changyan.js?conf='+ conf +'&appid=' + appid;
            h.insertBefore(s,h.firstChild);
            window.SCS_NO_IFRAME = true;
          })()
        </script>    
    </section>





</div>

        <div class="fixed-action-btn float-sitemap">
    <a class="btn-floating btn-large pink">
      <i class="fa fa-caret-square-o-up"></i>
    </a>
    <ul>
      <li><a class="btn-return-top btn-floating waves-effect green" title="回到顶部"><i class="fa fa-arrow-circle-o-up"></i></a></li>
      <li><a class="btn-floating waves-effect button-collapse yellow darken-1"  data-activates="main-menu" title="菜单"><i class="fa fa-navicon"></i></a></li>
    </ul>
  </div>

    </main>
    <footer class="page-footer indigo darken-1">
    
    <div class="footer-container container">
        <div class="row">
            
            <div class="social-group col m4 s12">
                <h5 class="white-text">社交</h5>
                
                    <a class="social-link" href="https://weibo.com/1903200010" target="_blank">
                        <i class="fa fa-2x fa-weibo"></i>
                    </a>
                
                    <a class="social-link" href="https://github.com/sherwin28" target="_blank">
                        <i class="fa fa-2x fa-github"></i>
                    </a>
                
                    <a class="social-link" href="/atom.xml" target="_blank">
                        <i class="fa fa-2x fa-rss"></i>
                    </a>
                
                
     <script async src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script>
    <div class="site-visitors-container white-text">
        <span>
            <i class="fa fa-user"></i>
            <span class="busuanzi-value" id="busuanzi_value_site_uv"></span>
        </span>
        <span>&nbsp;|&nbsp;</span>
        <span>
            <i class="fa fa-eye"></i>
            <span class="busuanzi-value" id="busuanzi_value_site_pv"></span>
        </span>
    </div>


            </div>
            

            
            <div class="col m8 s12">
                <h5 class="white-text">友情链接</h5>
                
                    <a class="social-link" href="http://blog.didispace.com/" target="_blank">程序猿DD</a>
                
                    <a class="social-link" href="https://springcloud.cc/" target="_blank">Spring Cloud中文网</a>
                
                    <a class="social-link" href="http://itmuch.com/" target="_blank">周立|Spring Cloud </a>
                
            </div>
            
        </div>
    </div>
    

    <div class="footer-copyright pink-link-context">
        <div class="container">
            © 2018 weiyuanbiao.cn, All rights reserved.
            <a href="http://weiyuanbiao.cn" style="margin-left:10px;">weiyuanbiao.cn</a>
            <a href="http://www.miitbeian.gov.cn" target="_blank" style="margin-left:10px;">粤ICP备15018188号-1</a>
            <!-- 
            <p class="right" style="margin-top: 0;">本博客由 <a href="https://hexo.io">Hexo</a> 强力驱动 | 主题 <a href="https://github.com/raytaylorlin/hexo-theme-raytaylorism">raytaylorism</a></p>
            -->
        </div>
    </div>
</footer>


<noscript>
    <div class="noscript">
        <p class="center-align">当前网速较慢或者你使用的浏览器不支持博客特定功能，请尝试刷新或换用Chrome、Firefox等现代浏览器</p>
    </div>
</noscript>
<div class="noscript">
    <p class="center-align">当前网速较慢或者你使用的浏览器不支持博客特定功能，请尝试刷新或换用Chrome、Firefox等现代浏览器</p>
</div>


<script src="/js/jquery.min.js"></script>
<script src="/js/materialize.min.js"></script>

<script>
    (function($) {
        $(document).ready(function() {
            // 隐藏禁用javascript（针对微信内置浏览器）的提示
            $('.noscript').hide();

            // 图片缩放效果
            var $imgs = $('img').not('.slider-image').not('.avatar-image').not('.carousel-image').not('.card-cover-image').not('.qrcode');

            // 给图片加上点击放大效果（materialbox插件）
            $imgs.addClass('materialboxed').each(function(i, el) {
                $(this).attr('data-caption', $(this).attr('alt') || ' ');
            }).materialbox();

            // 优化表格的显示
            $('table').each(function() {
                var $table = $(this);
                // 除去多行代码的情况
                if ($table.find('pre').length == 0) {
                    $table.addClass('responsive-table striped bordered');
                }
            });

            // 首页幻灯片
            $('.slider').slider({indicators: true, full_width: true, interval: 8000});

            $(".button-collapse").sideNav();
            $(".category-menu").sideNav();

            // 针对gallery post
            $('.carousel').carousel({full_width: true});
            $('.carousel-control.prev').click(function() {
                $('.carousel').carousel('prev');
            });
            $('.carousel-control.next').click(function() {
                $('.carousel').carousel('next');
            });

            // 文章目录
            $('article').not('.simple-article').find('h1').add('h2').add('h3').add('h4').add('h5').add('h6').scrollSpy();

            // 目录随屏幕滚动（防止目录过长越过footer）
            var $toc = $('.toc');
            var scrollTargetTop = 0;
            $(window).scroll(function() {
                var $activeLink = $toc.find('a.active.section');
                if ($(window).scrollTop() < 100) {
                    scrollTargetTop = 0;
                } else {
                    if ($activeLink[0]) {
                        scrollTargetTop = $activeLink.offset().top - $toc.offset().top;
                    }
                }
                $toc.css('top', '-' + scrollTargetTop + 'px');
            });

            // 修正文章目录的left-border颜色
            var color = $('.table-of-contents-text').css('color');
            $('.table-of-contents-link').css('border-left-color', color);

            // 针对移动端做的优化：FAB按钮点击一下收回
            if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) {
                $('.fixed-action-btn').addClass('click-to-toggle');
            }
            // 回到顶部
            $('.btn-return-top').click(function() {
                $('body, html').animate({
                    scrollTop: 0
                }, 500);
            });

            // 重置读书页面的Tab标签页的颜色
            $('li.tab a').hover(function() {
                $(this).toggleClass('text-lighten-4');
            });
            $('.indicator').addClass('pink lighten-2');

            
            // 添加new标签
            $('.menu-reading').append('<span class="new badge pink"></span>');
            

            // 搜索功能
            $('.modal-trigger').leanModal({
                // 打开搜索框时自动聚焦
                ready: function() {
                    if ($('#search').is(":visible")) {
                        $('#search-input').focus();
                    }
                }
            });
            var searchXml = "search.xml";
            if (searchXml.length == 0) {
             	searchXml = "search.xml";
            }
            var searchPath = "/" + searchXml;
            initSearch(searchPath, 'search-input', 'search-result');
        });

        // 初始化搜索与匹配函数
        var initSearch = function(path, search_id, content_id) {
            'use strict';
            $.ajax({
                url: path,
                dataType: "xml",
                success: function(xmlResponse) {
                    // get the contents from search data
                    var datas = $("entry", xmlResponse).map(function() {
                        return {
                            title: $("title", this).text(),
                            content: $("content", this).text(),
                            url: $("url", this).text()
                        };
                    }).get();
                    var $input = document.getElementById(search_id);
                    var $resultContent = document.getElementById(content_id);
                    $input.addEventListener('input', function() {
                        var str = '<ul class=\"search-result-list\">';
                        var keywords = this.value.trim().toLowerCase().split(/[\s\-]+/);
                        $resultContent.innerHTML = "";
                        if (this.value.trim().length <= 0) {
                            return;
                        }
                        // perform local searching
                        datas.forEach(function(data) {
                            var isMatch = true;
                            var content_index = [];
                            var data_title = data.title.trim().toLowerCase();
                            var data_content = data.content.trim().replace(/<[^>]+>/g, "").toLowerCase();
                            var data_url = data.url;
                            var index_title = -1;
                            var index_content = -1;
                            var first_occur = -1;
                            // only match artiles with not empty titles and contents
                            if (data_title != '' && data_content != '') {
                                keywords.forEach(function(keyword, i) {
                                    index_title = data_title.indexOf(keyword);
                                    index_content = data_content.indexOf(keyword);
                                    if (index_title < 0 && index_content < 0) {
                                        isMatch = false;
                                    } else {
                                        if (index_content < 0) {
                                            index_content = 0;
                                        }
                                        if (i == 0) {
                                            first_occur = index_content;
                                        }
                                    }
                                });
                            }
                            // show search results
                            if (isMatch) {
                                keywords.forEach(function(keyword) {
                                    var regS = new RegExp(keyword, "gi");
                                    data_title = data_title.replace(regS, "<span class=\"search-keyword pink lighten-2\">" + keyword + "</span>");
                                });

                                str += "<li><a href='" + data_url + "' class='search-result-title'>" + data_title + "</a>";
                                var content = data.content.trim().replace(/<[^>]+>/g, "");
                                if (first_occur >= 0) {
                                    // cut out 100 characters
                                    var start = first_occur - 20;
                                    var end = first_occur + 80;
                                    if (start < 0) {
                                        start = 0;
                                    }
                                    if (start == 0) {
                                        end = 100;
                                    }
                                    if (end > content.length) {
                                        end = content.length;
                                    }
                                    var match_content = content.substring(start, end);
                                    // highlight all keywords
                                    keywords.forEach(function(keyword) {
                                        var regS = new RegExp(keyword, "gi");
                                        match_content = match_content.replace(regS, "<span class=\"search-keyword pink lighten-2\">" + keyword + "</span>");
                                    });

                                    str += "<p class=\"search-result\">..." + match_content + "...</p>"
                                }
                                str += "</li>";
                            }
                        });
                        str += "</ul>";
                        $resultContent.innerHTML = str;
                    });
                }
            });
        }
    })(jQuery);
</script>


<script src="/js/prettify.js"></script>
<script type="text/javascript">
    $(document).ready(function() {
        $("pre").addClass("prettyprint");
        prettyPrint();
    });
</script>




<script type="text/javascript" src="http://tajs.qq.com/stats?sId=65472120" charset="UTF-8"></script>



<script type="text/x-mathjax-config">
MathJax.Hub.Config({
  tex2jax: {inlineMath: [['$','$'], ['\\(','\\)']]}
});
</script>
<script type="text/javascript" async
  src="//cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML">
</script>





</body>
</html>
